home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 1.0 / CIncludes / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-03  |  2.4 KB  |  139 lines  |  [TEXT/MPS ]

  1. /*
  2.     StdLib.h -- General utilities
  3.  
  4.     Copyright Apple Computer,Inc.    1987, 1990, 1993, 1994
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9. #ifndef __STDLIB__
  10. #define __STDLIB__
  11.  
  12. #ifndef __size_t__
  13. #define __size_t__
  14. typedef unsigned int size_t;
  15. #endif
  16.  
  17. #ifndef __wchar_t__
  18. #define __wchar_t__
  19. typedef short wchar_t;
  20. #endif
  21.  
  22. #ifdef powerc
  23. #pragma options align=power
  24. #endif
  25. struct div_t {
  26.     int quot;            /* quotient */
  27.     int rem;            /* remainder */
  28. } ;
  29. #ifdef powerc
  30. #pragma options align=reset
  31. #endif
  32. typedef struct div_t div_t;
  33.  
  34. #ifdef powerc
  35. #pragma options align=power
  36. #endif
  37. struct ldiv_t {
  38.     long int quot;        /* quotient */
  39.     long int rem;        /* remainder */
  40. };
  41. #ifdef powerc
  42. #pragma options align=reset
  43. #endif
  44. typedef struct ldiv_t ldiv_t;
  45.  
  46. #ifndef NULL
  47. #define NULL 0
  48. #endif
  49.  
  50. #define EXIT_FAILURE 1
  51. #define EXIT_SUCCESS 0
  52.  
  53. #define RAND_MAX 32767
  54.  
  55. #define MB_CUR_MAX 1
  56.  
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60.  
  61. /*
  62.  *    String conversion functions
  63.  */
  64.  
  65. double atof (const char *nptr);
  66. int atoi (const char *nptr);
  67. long int atol (const char *nptr);
  68. double strtod (const char *nptr, char **endptr);
  69. long int strtol (const char *nptr, char **endptr, int base);
  70. unsigned long int strtoul (const char *nptr, char **endptr, int base);
  71.  
  72.  
  73. /*
  74.  *    Pseudo-random sequence generation functions
  75.  */
  76.  
  77. int rand (void);
  78. void srand (unsigned int seed);
  79.  
  80.  
  81. /*
  82.  *    Memory management functions
  83.  */
  84.  
  85. void *calloc (size_t nmemb, size_t size);
  86. void free (void *ptr);
  87. void *malloc (size_t size);
  88. void *realloc (void *ptr, size_t size);
  89.  
  90.  
  91. /*
  92.  *    Communication with the environment
  93.  */
  94.  
  95. void abort (void);
  96. int atexit (void (*func)(void));
  97. void exit (int status);
  98. char *getenv (const char *name);
  99. int system (const char *string);
  100.  
  101.  
  102. /*
  103.  *    Searching and sorting utilities
  104.  */
  105.  
  106. void *bsearch (const void *key, const void *base,
  107.                size_t nmemb, size_t size,
  108.                int (*compar)(const void *, const void *));
  109. void qsort (void *base, size_t nmemb, size_t size,
  110.             int (*compar)(const void *, const void *));
  111.  
  112.  
  113. /*
  114.  *    Integer arithmetic functions
  115.  */
  116.  
  117. int abs (int j);
  118. div_t div (int numer, int denom);
  119. long int labs (long int j);
  120. ldiv_t ldiv (long int numer, long int denom);
  121.  
  122.  
  123. /*
  124.  *    Multibyte functions
  125.  */
  126.  
  127. int mblen (const char *s, size_t n);
  128. int mbtowc (wchar_t *pwc, const char *s, size_t n);
  129. int wctomb (char *s, wchar_t wchar);
  130. size_t mbstowcs (wchar_t *pwcs, const char *s, size_t n);
  131. size_t wcstombs (char *s, const wchar_t *pwcs, size_t n);
  132.  
  133.  
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137.  
  138. #endif
  139.